package org.ymh.unix_file_system.domain;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Arrays;

@Component
public class SuperBlock {//单位B

    /**(块号用四个字节来表示足以)
     * 文件系统类型xxx(弃用）
     * 文件系统总容量
     * 文件系统余下容量
     * 物理块大小
     * 块位图位置
     * inode节点大小
     * 目录项大小
     * inode位图位置
     * inode节点总个数
     * 物理块总个数
     * 物理块剩余个数
     * inode节点总数
     * inode节点剩余个数
     * 文件最大大小
     */
    public long fileSystemSize;//(KB)8B
    public long fileSystemRestSize;//(KB)余下空间 8B
    public byte blockSize;//(KB)1B
    public int[] blockBitMapLocation;//快位图的块号(设为最多占8块）32B
    public int[] inodeBitMapLocation;//inode位图（设为最多占8块）32B
    public byte inodeSize;//inode节点大小 1B
    public byte dirItemSize;//目录项大小 1B
    public int inodeCountSum;//inode总个数 4B
    public int blockCountSum;//物理块总个数 4B
    public int blockCountRest;//剩余物理块个数 4B
    public int inodeCountRest;//剩余inode个数 4B
    public int singeFileMaxSize;//(KB)单个文件最大量 4B

    public SuperBlock() {

    }

    @Override
    public String toString() {
        return "SuperBlock{" +
                "fileSystemSize=" + fileSystemSize +
                ", fileSystemRestSize=" + fileSystemRestSize +
                ", blockSize=" + blockSize +
                ", blockBitMapLocation=" + Arrays.toString(blockBitMapLocation) +
                ", inodeBitMapLocation=" + Arrays.toString(inodeBitMapLocation) +
                ", inodeSize=" + inodeSize +
                ", dirItemSize=" + dirItemSize +
                ", inodeCountSum=" + inodeCountSum +
                ", blockCountSum=" + blockCountSum +
                ", blockCountRest=" + blockCountRest +
                ", inodeCountRest=" + inodeCountRest +
                ", singeFileMaxSize=" + singeFileMaxSize +
                '}';
    }

    public long getFileSystemSize() {
        return fileSystemSize;
    }

    public void setFileSystemSize(long fileSystemSize) {
        this.fileSystemSize = fileSystemSize;
    }

    public long getFileSystemRestSize() {
        return fileSystemRestSize;
    }

    public void setFileSystemRestSize(long fileSystemRestSize) {
        this.fileSystemRestSize = fileSystemRestSize;
    }

    public byte getBlockSize() {
        return blockSize;
    }

    public void setBlockSize(byte blockSize) {
        this.blockSize = blockSize;
    }

    public int[] getBlockBitMapLocation() {
        return blockBitMapLocation;
    }

    public void setBlockBitMapLocation(int[] blockBitMapLocation) {
        this.blockBitMapLocation = blockBitMapLocation;
    }

    public int[] getInodeBitMapLocation() {
        return inodeBitMapLocation;
    }

    public void setInodeBitMapLocation(int[] inodeBitMapLocation) {
        this.inodeBitMapLocation = inodeBitMapLocation;
    }

    public byte getInodeSize() {
        return inodeSize;
    }

    public void setInodeSize(byte inodeSize) {
        this.inodeSize = inodeSize;
    }

    public byte getDirItemSize() {
        return dirItemSize;
    }

    public void setDirItemSize(byte dirItemSize) {
        this.dirItemSize = dirItemSize;
    }

    public int getInodeCountSum() {
        return inodeCountSum;
    }

    public void setInodeCountSum(int inodeCountSum) {
        this.inodeCountSum = inodeCountSum;
    }

    public int getBlockCountSum() {
        return blockCountSum;
    }

    public void setBlockCountSum(int blockCountSum) {
        this.blockCountSum = blockCountSum;
    }

    public int getBlockCountRest() {
        return blockCountRest;
    }

    public void setBlockCountRest(int blockCountRest) {
        this.blockCountRest = blockCountRest;
    }

    public int getInodeCountRest() {
        return inodeCountRest;
    }

    public void setInodeCountRest(int inodeCountRest) {
        this.inodeCountRest = inodeCountRest;
    }

    public int getSingeFileMaxSize() {
        return singeFileMaxSize;
    }

}
